// 封装提示消息
const toast = (options = {}) => {
  const jjj = 10
  const defaultObj = {
    title: '正在加载中',
    icon: 'none',
    duration: '2000',
    mask: true,
  }
  const opts = Object.assign({}, defaultObj, options)
  wx.showToast({
    ...opts
  });
};

// 封装模态框
const model = (options = {}) => {
  return new Promise((resolve) => {
    const defaultObj = {
      titel: '提示',
      content: '您确定要执行该操作吗',
      confirmColor: '#f3514f'
    }
    const opts = Object.assign({}, defaultObj, options)
    wx.showModal({
      ...opts,
      complete: (res) => {
        if (res.cancel) {
          console.log(取消了);
        }
        if (res.confirm) {
          console.log('确定了');
        }
      }
    })
  })
}



export { toast, model };
